local joy__kangkai = fk.CreateSkill {

  name = "joy__kangkai",

  tags = {  },

}



joy__kangkai:addEffect(fk.TargetConfirmed, {
  name = "joy__kangkai",
  anim_type = "support",
  events = {fk.TargetConfirmed},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(joy__kangkai.name) and data.card.trueName == "slash" and
    (player == target or player:distanceTo(target) == 1)
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askForSkillInvoke(player, joy__kangkai.name, nil, "#joy__kangkai-invoke")
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, joy__kangkai.name)
    if player == target or player:isNude() or target.dead or player:getMark("joy__kangkai-turn") == 2 then return end
    local cards = room:askForCard(player, 1, 1, true, joy__kangkai.name, true, ".", "#joy__kangkai-give::"..target.id)
    if #cards > 0 then
      room:addPlayerMark(player, "joy__kangkai-turn")
      room:moveCardTo(cards,Card.PlayerHand,target,fk.ReasonGive,joy__kangkai.name,nil,true,player)
      local card = Fk:getCardById(cards[1])
      if card.type == Card.TypeEquip and not target.dead and not target:isProhibited(target, card) and not target:prohibitUse(card) and
        table.contains(target:getCardIds("h"), card.id) and
        room:askForSkillInvoke(target, joy__kangkai.name, data, "#kangkai-use:::"..card:toLogString()) then
        room:useCard({
          from = target.id,
          tos = {{target.id}},
          card = card,
        })
      end
    end
  end,
})

return joy__kangkai